<!DOCTYPE html>
<head>
	<title>Registration</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="keywords" content="" />
	<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
	<!-- bootstrap-css -->
	<link rel="stylesheet" href="/css/bootstrap.min.css" >
	<!-- //bootstrap-css -->
	<!-- Custom CSS -->
	<link href="/css/style.css" rel='stylesheet' type='text/css' />
	<link href="/css/style-responsive.css" rel="stylesheet"/>
	<!-- font CSS -->
	<!--
    <link href='http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
    -->
	<!-- font-awesome icons -->
	<link rel="stylesheet" href="/css/font.css" type="text/css"/>
	<link href="/css/font-awesome.css" rel="stylesheet">
	<!-- //font-awesome icons -->
	<script src="/js/jquery2.0.3.min.js"></script>
</head>
<body>
<div class="reg-w3">
	<div class="w3layouts-main">
		<h2>短信验证</h2>
		<form action="#" method="post">
			<input type="text" class="ggg" name="empName" placeholder="请输入用户名" required="" id="empName">
			<input type="text" class="ggg" name="empPhone" placeholder="请输入手机号" required="" id="empPhone">
			<input type="text" class="ggg" name="verifyCode" placeholder="请输入验证码" required="" id="veryCode">

			<div class="clearfix"></div>
			<input type="submit" value="确认验证" name="register">
		</form>
	</div>
</div>
<script src="/js/bootstrap.js"></script>
<script src="/js/jquery.dcjqaccordion.2.7.js"></script>
<script src="/js/scripts.js"></script>
<script src="/js/jquery.slimscroll.js"></script>
<script src="/js/jquery.nicescroll.js"></script>
<script src="/js/jquery.scrollTo.js"></script>
</body>
</html>
<script type="text/javascript">
    $("#empPhone").blur(function () {
        $.ajax({
            type:"POST",
            url:"/emp/getInfo.do",
            dataType:"json",
            data:{
                empName:$("#empName").val()
            },
            success:function (data) {
                alert(data.emp.empPhone);
                if(data.emp.euuId==null){
                    //用户名不正确
                    alert("用戶名不正確");
                }else {
                    if (data.emp.empPhone!=$("#empPhone").val()){
                        //手机号不匹配
                        alert("手機號不匹配");
                    }else {
                        $.ajax({
                            type:"POST",
                            url:"/emp/getVeryCode.do",
                            dataType:"json",
                            data:{
                                empPhone:data.emp.empPhone
                            },
                            success:function (data) {
                                $("#veryCode").blur(function () {
                                    if($("#veryCode").val()==data.veryCode){
                                        window.location.href="/updatePWD.html";
                                    }
                                });
                            }
                        });
                    }
                }

            }
        });
    });


</script>
